package org.tag;

import org.apache.commons.lang3.StringUtils;
import org.core.enums.SysThemesEnum;
import org.util.SysThemesUtil;
import org.util.oConvertUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;

/**
 * @author 张代浩
 */
public class BaseTag extends TagSupport {
    private static final long serialVersionUID = 1L;

    protected String type = "default";// 加载类型

    protected String cssTheme;

    public String getCssTheme() {
        return cssTheme;
    }


    public void setCssTheme(String cssTheme) {
        this.cssTheme = cssTheme;
    }


    public void setType(String type) {
        this.type = type;
    }

    private String rootpath;

    public int doStartTag() throws JspException {
        return EVAL_PAGE;
    }

    /*A.parent属性：代表嵌套了当前标签的上层标签的处理类

    B.pageContex属性：代表Web应用中的javax.servlet.jsp.PageContext对象*/
    public int doEndTag() throws JspException {

        rootpath = pageContext.getServletContext().getContextPath();
        JspWriter out = null;
        StringBuffer sb = new StringBuffer();
        String types[] = type.split(",");
        try {
            out = this.pageContext.getOut();
/*//			update-start--Author:longjb  Date:20150408 for：手动设置指定属性主题优先
            //if (cssTheme == null) {//
				Cookie[] cookies = ((HttpServletRequest) super.pageContext
						.getRequest()).getCookies();
				for (Cookie cookie : cookies) {
					if (cookie == null || StringUtils.isEmpty(cookie.getName())) {
						continue;
					}
					if (cookie.getName().equalsIgnoreCase("JEECGCSSTHEME")) {
						cssTheme = cookie.getValue();
					}
				}
			//}

			if(cssTheme==null||"".equals(cssTheme)){
				cssTheme="default";
			}*/
            SysThemesEnum sysThemesEnum = null;
            if (StringUtils.isEmpty(cssTheme) || "null".equals(cssTheme)) {
                sysThemesEnum = SysThemesUtil.getSysTheme((HttpServletRequest) super.pageContext.getRequest());
            } else {
                sysThemesEnum = SysThemesEnum.toEnum(cssTheme);
            }

            //插入多语言脚本
            String lang = (String) ((HttpServletRequest) this.pageContext.getRequest()).getSession().getAttribute("lang");
            //String langjs = StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/mutiLang/{0}.js\"></script>", "{0}", lang);
            //	sb.append(langjs);

            if (oConvertUtils.isIn("cloudAdmin", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/css/cloud-admin.css\">");
            }
            if (oConvertUtils.isIn("themesDefault", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/css/theme/default.css\" id=\"skin-switcher\">");
            }
            if (oConvertUtils.isIn("responsive", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/css/responsive.css\">");
            }
            if (oConvertUtils.isIn("fontAwesome", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/font-awesome/css/font-awesome.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/font-awesome/css/font-awesome.min.css\">");
            }
            if (oConvertUtils.isIn("animate", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/css/animatecss/animate.min.css\">");
            }
            if (oConvertUtils.isIn("jquery", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery/jquery-2.0.3.min.js\"></script>");
            }
            if (oConvertUtils.isIn("jquerySpinner", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/img/EU/plugins/jquery.spinner.js\"></script>");
            }
            if (oConvertUtils.isIn("jqueryUI", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/jquery-ui-1.10.3.custom/css/custom-theme/jquery-ui-1.10.3.custom.min.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js\"></script>");
            }
            if (oConvertUtils.isIn("bootstrap", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/bootstrap/css/bootstrap.min.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/bootstrap/js/bootstrap.min.js\"></script>");
            }

            if (oConvertUtils.isIn("jquery-ui-bootstrap:jquery-ui", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/css/bootstrap.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/css/custom-theme/jquery-ui-1.10.2.custom.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/css/custom-theme/jquery.ui.1.10.2.ie.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/css/font-awesome/font-awesome.min.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/css/font-awesome/font-awesome-ie7.min.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/css/layout-default-1.3.0.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/js/jquery.layout-latest.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/js/jquery.blockUI.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/js/bootstrap.file-input.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/js/bootstrap.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-ui-bootstrap/js/jquery-ui-1.10.2.custom.min.js\"></script>");

            }
            if (oConvertUtils.isIn("bootstrap-datetimepicker", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js\"></script>");
            }

            if (oConvertUtils.isIn("jQuery-Validation-Engine", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/jQuery-Validation-Engine/css/validationEngine.jquery.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jQuery-Validation-Engine/js/jquery.validationEngine.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jQuery-Validation-Engine/js/languages/jquery.validationEngine-zh_CN.js\"></script>");
            }
            if (oConvertUtils.isIn("amcharts", types)) {
              sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/amcharts/amcharts.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/amcharts/serial.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/amcharts/pie.js\"></script>");

            }

            if (oConvertUtils.isIn("nicescroll", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/nicescroll/jquery.nicescroll.min.js?\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/nicescroll/jquery.nicescroll.plus.js\"></script>");
            }

            if (oConvertUtils.isIn("jqueryValidate", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-Validate/jquery.validate.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-Validate/messages_zh.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jquery-Validate/jquery.validate.myself.js\"></script>");
            }
            if (oConvertUtils.isIn("uniform", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/uniform/css/uniform.default.min.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/uniform/jquery.uniform.min.js\"></script>");
            }

            if (oConvertUtils.isIn("fullCalendar", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/fullcalendar/fullcalendar.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/fullcalendar/fullcalendar.js\"></script>");
            }


            if (oConvertUtils.isIn("select2", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/select2/select2.min.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/select2/select2.min.js\"></script>");
            }

            if (oConvertUtils.isIn("dataTables", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/dataTables/1.10.13/jquery.dataTables.min.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/dataTables/select/select.dataTables.min.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/dataTables/extras/TableTools/media/css/TableTools.min.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/dataTables/extras/buttons/buttons.dataTables.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/dataTables/media/assets/css/datatables.min.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/dataTables/1.10.13/jquery.dataTables.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/dataTables/select/dataTables.select.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/dataTables/extras/buttons/dataTables.buttons.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/dataTables/media/assets/js/datatables.min.js\"></script>");
            }

            // CKEditor是全球最优秀的网页在线文字编辑器之一
            if (oConvertUtils.isIn("ckeditor", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/ckeditor/css/sample.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/ckeditor/ckeditor.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/tools/ckeditorTool.js\"></script>");
            }

            if (oConvertUtils.isIn("dateRangePicker", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/bootstrap-daterangepicker/daterangepicker-bs3.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/bootstrap-daterangepicker/moment.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/bootstrap-daterangepicker/daterangepicker.min.js\"></script>");

            }
            if (oConvertUtils.isIn("blockUI", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jQuery-BlockUI/jquery.blockUI.min.js\"></script>");
            }
            if (oConvertUtils.isIn("slimScroll", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js\"></script>");
            }
            //Flot是一个jQuery绘图库。主要用于简单的绘制图表功能。具有吸引人的渲染外观和互操作的特性。
            if (oConvertUtils.isIn("flot-charts", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/jquery.flot.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/excanvas.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/jquery.flot.time.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/jquery.flot.selection.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/jquery.flot.resize.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/jquery.flot.pie.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/jquery.flot.stack.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/jquery.flot.crosshair.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/flot/jquery.flot.categories.min.js\"></script>");
            }
            if (oConvertUtils.isIn("jQuery-Cookie", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/jQuery-Cookie/jquery.cookie.min.js\"></script>");
            }

           /* if (oConvertUtils.isIn("ckfinder", types)) {
                sb.append("<script type=\"text/javascript\" src=\"plug-in/ckfinder/ckfinder.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/ckfinderTool.js\"></script>");
            }*/
            /*if (oConvertUtils.isIn("easyui", types)) {
                sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/dataformat.js\"></script>");

//				sb.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"plug-in/easyui/themes/"+cssTheme+"/easyui.css\" type=\"text/css\"></link>");
                sb.append(SysThemesUtil.getEasyUiTheme(sysThemesEnum));
                sb.append(SysThemesUtil.getEasyUiMainTheme(sysThemesEnum));

                sb.append(SysThemesUtil.getEasyUiIconTheme(sysThemesEnum));
//				sb.append("<link rel=\"stylesheet\" href=\"plug-in/easyui/themes/icon.css\" type=\"text/css\"></link>");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/accordion.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/icons.css\">");
                sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/zh-cn.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/syUtil.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/extends/datagrid-scrollview.js\"></script>");
            }*/

            /*if (oConvertUtils.isIn("hubspot-messenger", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/hubspot-messenger/css/messenger.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/hubspot-messenger/css/messenger-spinner.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/hubspot-messenger/css/messenger-theme-air.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/hubspot-messenger/css/messenger-theme-block.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/hubspot-messenger/css/messenger-theme-flat.css\">");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/hubspot-messenger/css/messenger-theme-ice.css\">");

                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/hubspot-messenger/js/messenger.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/hubspot-messenger/js/messenger-theme-flat.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/hubspot-messenger/js/messenger-theme-future.js\"></script>");
            }*/
            if (oConvertUtils.isIn("script", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/script.js\"></script>");
            }
            if (oConvertUtils.isIn("main", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/main.js\"></script>");
            }
            if (oConvertUtils.isIn("navigation", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/navigation.js\"></script>");
            }
            if (oConvertUtils.isIn("tdjkc", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/css/tdjkc.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/tdjkc.js\"></script>");
            }

            if (oConvertUtils.isIn("box", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/css/box.css\">");
            }

            if (oConvertUtils.isIn("common", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/common.js\"></script>");
            }
            if (oConvertUtils.isIn("datePicker", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/My97DatePicker/WdatePicker.js\"></script>");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/My97DatePicker/skin/WdatePicker.css\">");
            }
            /**
             * 信息提示框美化插件
             */
            if (oConvertUtils.isIn("layer", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/layer/layer.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/layer/extend/layer.ext.js\"></script>");
            }
            if (oConvertUtils.isIn("autosize", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/autosize/jquery.autosize.min.js\"></script>");
            }
            if (oConvertUtils.isIn("inputmask", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/bootstrap-inputmask/bootstrap-inputmask.min.js\"></script>");
            }
            if (oConvertUtils.isIn("bootstrap-fileupload", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/bootstrap-fileupload/bootstrap-fileupload.min.js\"></script>");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/bootstrap-fileupload/bootstrap-fileupload.min.css\">");
            }
            if (oConvertUtils.isIn("tmpl", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/blueimp/javascript-template/tmpl.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/blueimp/javascript-canvas-to-blob/canvas-to-blob.min.js\"></script>");
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/plug-in/blueimp/gallery/blueimp-gallery.min.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/blueimp/gallery/jquery.blueimp-gallery.min.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/blueimp/javascript-loadimg/load-image.min.js\"></script>");
            }
            if (oConvertUtils.isIn("typeahead", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/typeahead/typeahead.min.js\"></script>");
            }
            if (oConvertUtils.isIn("countable", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/countable/jquery.simplyCountable.min.js\"></script>");
            }

            if (oConvertUtils.isIn("application", types)) {
                sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + rootpath + "/resources/css/application.css\">");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/application.js\"></script>");
            }
            if (oConvertUtils.isIn("lSelect", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/jquery.lSelect.js\"></script>");
            }
            if (oConvertUtils.isIn("default", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/default.js\"></script>");
            }
            if (oConvertUtils.isIn("highCharts", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/plug-in/highcharts/highcharts.js\"></script>");
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/highChartTools.js\"></script>");
            }
            if (oConvertUtils.isIn("json2", types)) {
                sb.append("<script type=\"text/javascript\" src=\"" + rootpath + "/resources/js/json2.js\"></script>");
            }
            out.print(sb.toString());
            out.flush();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (out != null) {
                try {
                    out.clearBuffer();
                    sb.setLength(0);

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

        }
        //表示JSP页面继续运行
        return EVAL_PAGE;
    }

}
